﻿using UnityEngine;
using System.Collections;

public class BodyPart : MonoBehaviour 
{
    public GameObject ConnectStart;
    public GameObject ConnectEnd;
    public GameObject Body;

    public Vector3 EndPosition()
    {
        if (ConnectEnd != null)
        {
            return transform.TransformPoint(ConnectEnd.transform.localPosition);
        }
        else
            return Vector3.zero;
    }

    public Vector3 Direction()
    {
        return (transform.TransformPoint(ConnectEnd.transform.localPosition) - transform.TransformPoint(ConnectStart.transform.localPosition)).normalized;
    }
}
